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.IAssetsValueTypeService;
import com.dayou.entity.AssetsValueType;
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("assetsValueType")
@Slf4j
public class AssetsValueTypeController extends BaseController {
    @Autowired
    private IAssetsValueTypeService assetsValueTypeService;

    /**
     * 获取所有资产价值类型
     * @return List<AssetsValueType>
     */
    @GetMapping("/getAssetsValueType")
    public RestResponse<List<AssetsValueType>> getAssetsValueType() {
        return RestResponse.data(assetsValueTypeService.getAssetsValueType());
    }

    /**
    * 价值类型表列表
    */
    @GetMapping("")
    public RestResponse<Page<AssetsValueType>> page(AssetsValueType assetsValueType, Page page){
        Page<AssetsValueType> pages=assetsValueTypeService.selectPage(page,assetsValueType);
        return RestResponse.data(pages);
    }

    /**
     * 价值类型表详情
     */
    @GetMapping("/{id}")
    public RestResponse<AssetsValueType> detail(@PathVariable Long id){
        AssetsValueType xAssetsValueType =assetsValueTypeService.detail(id);
        return RestResponse.data(xAssetsValueType);
     }

    /**
     * 价值类型表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody AssetsValueType assetsValueType) {
        Boolean ret = assetsValueTypeService.add(assetsValueType);
        return RestResponse.data(ret);
    }

    /**
     * 价值类型表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody AssetsValueType assetsValueType) {
        Boolean ret = assetsValueTypeService.update(assetsValueType);
        return RestResponse.data(ret);
    }

    /**
     * 价值类型表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = assetsValueTypeService.delete(id);
        return RestResponse.data(ret);
    }


}

