package com.njzscloud.supervisory.biz.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.biz.pojo.entity.BizObjEntity;
import com.njzscloud.supervisory.biz.service.BizObjService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 客户分类
 */
@Slf4j
@RestController
@RequestMapping("/biz_obj")
@RequiredArgsConstructor
public class BizObjController {

    private final BizObjService bizObjService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody BizObjEntity bizObjEntity) {
        bizObjService.add(bizObjEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody BizObjEntity bizObjEntity) {
        bizObjService.modify(bizObjEntity);
        return R.success();
    }

    /**
     * 删除
     */
    @PostMapping("/del")
    public R<?> del(@RequestBody List<Long> ids) {
        bizObjService.del(ids);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<BizObjEntity> detail(@RequestParam Long id) {
        return R.success(bizObjService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<BizObjEntity>> paging(PageParam pageParam, BizObjEntity bizObjEntity) {
        return R.success(bizObjService.paging(pageParam, bizObjEntity));
    }

}
