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.IItemEvaluateService;
import com.dayou.entity.ItemEvaluate;
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 wucl
 * @since 2023-03-03
 */
@RestController
@RequestMapping("itemEvaluate")
@Slf4j
public class ItemEvaluateController extends BaseController {
    @Autowired
    private IItemEvaluateService itemEvaluateService;

    /**
    * 项目完结评价表列表
    */
    @GetMapping("")
    public RestResponse<Page<ItemEvaluate>> page(ItemEvaluate itemEvaluate, Page page){
        Page<ItemEvaluate> pages=itemEvaluateService.selectPage(page,itemEvaluate);
        return RestResponse.data(pages);
    }

    /**
     * 项目完结评价表详情
     */
    @GetMapping("/{id}")
    public RestResponse<ItemEvaluate> detail(@PathVariable Long id){
        ItemEvaluate xItemEvaluate =itemEvaluateService.detail(id);
        return RestResponse.data(xItemEvaluate);
     }

    /**
     * 根据项目id查询项目完结评价表详情
     */
    @GetMapping("/itemId/{itemId}")
    public RestResponse<ItemEvaluate> detailByItemId(@PathVariable Long itemId){
        ItemEvaluate xItemEvaluate =itemEvaluateService.detailByItemId(itemId);
        return RestResponse.data(xItemEvaluate);
    }
    /**
     * 项目完结评价表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody ItemEvaluate itemEvaluate) {
        Boolean ret = itemEvaluateService.add(itemEvaluate);
        return RestResponse.data(ret);
    }

    /**
     * 项目完结评价表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody ItemEvaluate itemEvaluate) {
        Boolean ret = itemEvaluateService.update(itemEvaluate);
        return RestResponse.data(ret);
    }

    /**
     * 项目完结评价表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = itemEvaluateService.delete(id);
        return RestResponse.data(ret);
    }


}

