package com.dayou.controller;

import com.dayou.vo.TeamVO;
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.ITeamMemberService;
import com.dayou.entity.TeamMember;
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-04-07
 */
@RestController
@RequestMapping("teamMember")
@Slf4j
public class TeamMemberController extends BaseController {
    @Autowired
    private ITeamMemberService teamMemberService;

    /**
    * 团队成员列表
    */
    @GetMapping("")
    public RestResponse<Page<TeamMember>> page(TeamMember teamMember, Page page){
        Page<TeamMember> pages=teamMemberService.selectPage(page,teamMember);
        return RestResponse.data(pages);
    }

    /**
     * 团队成员详情
     */
    @GetMapping("/{id}")
    public RestResponse<TeamMember> detail(@PathVariable Long id){
        TeamMember xTeamMember =teamMemberService.detail(id);
        return RestResponse.data(xTeamMember);
     }

    /**
     * 团队成员新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody TeamVO teamVO) {
        Boolean ret = teamMemberService.add(teamVO);
        return RestResponse.data(ret);
    }

    /**
     * 团队成员更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody TeamMember teamMember) {
        Boolean ret = teamMemberService.update(teamMember);
        return RestResponse.data(ret);
    }

    /**
     * 团队成员删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = teamMemberService.delete(id);
        return RestResponse.data(ret);
    }


}

