package com.zcloud.modules.custormerInfo.controller;

import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.common.utils.Tools;
import com.zcloud.modules.custormerInfo.entity.BusCustomerinfoRequireEntity;
import com.zcloud.modules.custormerInfo.service.BusCustomerinfoRequireService;
import com.zcloud.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;

/**
 * @Author zhangQiHang
 * @Desc 客户课程要求(BusCustomerinfoRequire)表控制层
 * @Date 2025-05-09 09:13:51
 */
@Api(tags = "客户课程要求")
@RestController
@RequestMapping("busCustomerinfoRequire")
public class BusCustomerinfoRequireController extends AbstractController {

    @Autowired
    private BusCustomerinfoRequireService busCustomerinfoRequireService;

    @ApiOperation("客户课程要求-新增数据")
    @SysLog("客户课程要求-新增数据")
    @PostMapping("/save")
    public R insert(@RequestBody BusCustomerinfoRequireEntity param) {
        param.setCreator(getUserId());
		param.setOperator(getUserId());
		param.setCustomerinfoRequireId(Tools.get32UUID());
        busCustomerinfoRequireService.save(param);

        return R.ok();
    }

    @ApiOperation("客户课程要求-编辑数据")
    @SysLog("客户课程要求-编辑数据")
    @PostMapping("/update")
    public R update(@RequestBody BusCustomerinfoRequireEntity param) {
        param.setOperator(getUserId());
        busCustomerinfoRequireService.updateById(param);

        return R.ok();
    }


    @ApiOperation("客户课程要求-删除数据")
    @SysLog("客户课程要求-删除数据")
    @PostMapping("/delete")
    public R delete(@RequestBody BusCustomerinfoRequireEntity param) {
        busCustomerinfoRequireService.delete(param.getCustomerinfoRequireId(),getUserId());
        return R.ok();
    }

    @ApiOperation("客户课程要求-分页查询")
    @SysLog("客户课程要求-分页查询")
    @PostMapping("/listPage")
    public R listPage(@RequestBody Map<String, Object> params) {
        PageUtils page = busCustomerinfoRequireService.listPage(params);

		return R.ok().put("page", page);
    }


    @ApiOperation("客户课程要求-根据ID查详情")
    @SysLog("客户课程要求-根据ID查详情")
    @PostMapping("/info")
    public R info(@RequestBody BusCustomerinfoRequireEntity param) {
        BusCustomerinfoRequireEntity busCustomerinfoRequire = busCustomerinfoRequireService.getById(param.getCustomerinfoRequireId());
        return R.ok().put("busCustomerinfoRequire", busCustomerinfoRequire);
    }

}
