package com.dayou.controller;

import com.dayou.vo.DeductionTechItemVO;
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.IItemBrokerageTechnicistService;
import com.dayou.entity.ItemBrokerageTechnicist;
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-06-06
 */
@RestController
@RequestMapping("itemBrokerageTechnicist")
@Slf4j
public class ItemBrokerageTechnicistController extends BaseController {
    @Autowired
    private IItemBrokerageTechnicistService itemBrokerageTechnicistService;

    /**
    * 技术人员项目提成总表列表
    */
    @GetMapping("")
    public RestResponse<Page<DeductionTechItemVO>> page(DeductionTechItemVO deductionTechItemVO, Page page){
        Page<DeductionTechItemVO> pages=itemBrokerageTechnicistService.selectPage(page,deductionTechItemVO);
        return RestResponse.data(pages);
    }

    /**
     * 技术人员项目提成总表详情
     */
    @GetMapping("/{id}")
    public RestResponse<ItemBrokerageTechnicist> detail(@PathVariable Long id){
        ItemBrokerageTechnicist xItemBrokerageTechnicist =itemBrokerageTechnicistService.detail(id);
        return RestResponse.data(xItemBrokerageTechnicist);
     }

    /**
     * 技术人员项目提成总表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody ItemBrokerageTechnicist itemBrokerageTechnicist) {
        Boolean ret = itemBrokerageTechnicistService.add(itemBrokerageTechnicist);
        return RestResponse.data(ret);
    }

    /**
     * 技术人员项目提成总表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody ItemBrokerageTechnicist itemBrokerageTechnicist) {
        Boolean ret = itemBrokerageTechnicistService.update(itemBrokerageTechnicist);
        return RestResponse.data(ret);
    }

    /**
     * 技术人员项目提成总表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = itemBrokerageTechnicistService.delete(id);
        return RestResponse.data(ret);
    }

    /**
     * 全额回款户一次性结算项目
     */
    @GetMapping("/once")
    public RestResponse<Page<DeductionTechItemVO>> oncePage(DeductionTechItemVO deductionTechItemVO, Page page){
        Page<DeductionTechItemVO> pages=itemBrokerageTechnicistService.oncePage(page,deductionTechItemVO);
        return RestResponse.data(pages);
    }

}

