package com.goafanti.Interview.controller;

import com.goafanti.Interview.service.UserInterviewProjectService;
import com.goafanti.common.bo.Result;
import com.goafanti.common.controller.BaseController;
import com.goafanti.common.model.UserInterviewProject;
import com.goafanti.common.model.UserInterviewProjectBo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 客户面谈项目表(UserInterviewProject)表控制层
 *
 * @author makejava
 * @since 2025-04-11 11:02:01
 */
@RestController
@RequestMapping("/api/admin/userInterviewProject")
public class UserInterviewProjectController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private UserInterviewProjectService userInterviewProjectService;


    /**
     * 新增客户面谈项目表
     *
     * @param userInterviewProject 实体
     * @return 新增结果
     */
    @PostMapping("/add")
    public Result add(UserInterviewProject userInterviewProject) {
        return new Result<>().data(this.userInterviewProjectService.insert(userInterviewProject));
    }


    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/get")
    public Result<UserInterviewProject> queryById(Integer id) {
        return new Result<>().data(this.userInterviewProjectService.queryById(id));
    }


    /**
     * 编辑数据
     *
     * @param userInterviewProject 实体
     * @return 编辑结果
     */
    @PostMapping("/update")
    public Result edit(UserInterviewProject userInterviewProject) {
        return new Result<>().data(this.userInterviewProjectService.update(userInterviewProject));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @GetMapping("/delete")
    public Result deleteById(Integer id) {
        return new Result<>().data(this.userInterviewProjectService.deleteById(id));
    }

    /**
     * 列表查询
     *
     * @param in 参数
     * @return
     */
    @GetMapping("/list")
    public Result<UserInterviewProjectBo> list(UserInterviewProject in, Integer pageNo, Integer pageSize) {
        return new Result<>().data(this.userInterviewProjectService.list(in, pageNo, pageSize));
    }

}

