package com.bonus.sgzb.app.controller;

import com.bonus.sgzb.app.domain.LeaseUserBook;
import com.bonus.sgzb.app.service.LeaseUserBookService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * @author c liu
 * @date 2024/1/4
 */
@RestController
@RequestMapping("/base/leaseUserBook")
public class LeaseUserBookController  extends BaseController {
    @Autowired
    private LeaseUserBookService service;

    @GetMapping
    public AjaxResult getLeaseUserBook(){
        Long userId = SecurityUtils.getLoginUser().getUserid();
        return AjaxResult.success(service.getLeaseUserBook(userId));
    }

    @PostMapping
    public AjaxResult add(@RequestBody LeaseUserBook bean){
        return toAjax(service.add(bean));
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody LeaseUserBook bean){
        return toAjax(service.update(bean));
    }
    @DeleteMapping
    public AjaxResult batchDel(@RequestBody ArrayList<Integer> ids){
        return toAjax(service.batchDel(ids));
    }


}
