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.IAssetsEvaluationTargetPurposeService;
import com.dayou.entity.AssetsEvaluationTargetPurpose;
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("assetsEvaluationTargetPurpose")
@Slf4j
public class AssetsEvaluationTargetPurposeController extends BaseController {
    @Autowired
    private IAssetsEvaluationTargetPurposeService assetsEvaluationTargetPurposeService;

    /**
     * 获取所有资产评估目的集合
     * @return RestResponse<List<AssetsEvaluationTargetPurpose>>
     */
    @GetMapping("/getPurpose")
    public RestResponse<List<AssetsEvaluationTargetPurpose>> getPurpose() {
        return RestResponse.data(assetsEvaluationTargetPurposeService.getPurpose());
    }

    /**
    * 资产评估对象评估目的表列表
    */
    @GetMapping("")
    public RestResponse<Page<AssetsEvaluationTargetPurpose>> page(AssetsEvaluationTargetPurpose assetsEvaluationTargetPurpose, Page page){
        Page<AssetsEvaluationTargetPurpose> pages=assetsEvaluationTargetPurposeService.selectPage(page,assetsEvaluationTargetPurpose);
        return RestResponse.data(pages);
    }

    /**
     * 资产评估对象评估目的表详情
     */
    @GetMapping("/{id}")
    public RestResponse<AssetsEvaluationTargetPurpose> detail(@PathVariable Long id){
        AssetsEvaluationTargetPurpose xAssetsEvaluationTargetPurpose =assetsEvaluationTargetPurposeService.detail(id);
        return RestResponse.data(xAssetsEvaluationTargetPurpose);
     }

    /**
     * 资产评估对象评估目的表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody AssetsEvaluationTargetPurpose assetsEvaluationTargetPurpose) {
        Boolean ret = assetsEvaluationTargetPurposeService.add(assetsEvaluationTargetPurpose);
        return RestResponse.data(ret);
    }

    /**
     * 资产评估对象评估目的表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody AssetsEvaluationTargetPurpose assetsEvaluationTargetPurpose) {
        Boolean ret = assetsEvaluationTargetPurposeService.update(assetsEvaluationTargetPurpose);
        return RestResponse.data(ret);
    }

    /**
     * 资产评估对象评估目的表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = assetsEvaluationTargetPurposeService.delete(id);
        return RestResponse.data(ret);
    }


}

