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.IPersonalExampleService;
import com.dayou.entity.PersonalExample;
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 2024-03-01
 */
@RestController
@RequestMapping("personalExample")
@Slf4j
public class PersonalExampleController extends BaseController {
    @Autowired
    private IPersonalExampleService personalExampleService;

    /**
    * 个贷可比实例列表
    */
    @GetMapping("")
    public RestResponse<Page<PersonalExample>> page(PersonalExample personalExample, Page page){
        Page<PersonalExample> pages=personalExampleService.selectPage(page,personalExample);
        return RestResponse.data(pages);
    }

    /**
     * 个贷可比实例详情
     */
    @GetMapping("/{id}")
    public RestResponse<PersonalExample> detail(@PathVariable Long id){
        PersonalExample xPersonalExample =personalExampleService.detail(id);
        return RestResponse.data(xPersonalExample);
     }

    /**
     * 个贷可比实例新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody PersonalExample personalExample) {
        Boolean ret = personalExampleService.add(personalExample);
        return RestResponse.data(ret);
    }

    /**
     * 个贷可比实例更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody PersonalExample personalExample) {
        Boolean ret = personalExampleService.update(personalExample);
        return RestResponse.data(ret);
    }

    /**
     * 个贷可比实例删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = personalExampleService.delete(id);
        return RestResponse.data(ret);
    }


}

