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.modules.custormerInfo.entity.BusTeacherAuditRecordEntity;
import com.zcloud.modules.custormerInfo.service.BusTeacherAuditRecordService;
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 wangyitao
 * @Desc 教师认证审核记录表(BusTeacherAuditRecord)表控制层
 * @Date 2024-10-15 14:33:52
 */
@Api(tags = "教师认证审核记录表")
@RestController
@RequestMapping("busTeacherAuditRecord")
public class BusTeacherAuditRecordController extends AbstractController {

    @Autowired
    private BusTeacherAuditRecordService busTeacherAuditRecordService;

    @ApiOperation("教师认证审核记录表-新增数据")
    @SysLog("教师认证审核记录表-新增数据")
    @PostMapping("/save")
    public R insert(@RequestBody BusTeacherAuditRecordEntity param) {
        param.setCreator(getUserId());
        param.setOperator(getUserId());
        busTeacherAuditRecordService.insert(param);

        return R.ok();
    }

    @ApiOperation("教师认证审核记录表-编辑数据")
    @SysLog("教师认证审核记录表-编辑数据")
    @PostMapping("/update")
    public R update(@RequestBody BusTeacherAuditRecordEntity param) {
        param.setOperator(getUserId());
        busTeacherAuditRecordService.updateById(param);

        return R.ok();
    }


    @ApiOperation("教师认证审核记录表-删除数据")
    @SysLog("教师认证审核记录表-删除数据")
    @PostMapping("/delete")
    public R delete(@RequestBody BusTeacherAuditRecordEntity param) {
        busTeacherAuditRecordService.delete(param.getTeacherAuditRecordId(), getUserId());
        return R.ok();
    }

    @ApiOperation("教师认证审核记录表-分页查询")
    @SysLog("教师认证审核记录表-分页查询")
    @PostMapping("/listPage")
    public R listPage(@RequestBody Map<String, Object> params) {
        PageUtils page = busTeacherAuditRecordService.listPage(params);

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


    @ApiOperation("教师认证审核记录表-根据ID查详情")
    @SysLog("教师认证审核记录表-根据ID查详情")
    @PostMapping("/info")
    public R info(@RequestBody BusTeacherAuditRecordEntity param) {
        BusTeacherAuditRecordEntity busTeacherAuditRecord = busTeacherAuditRecordService.getById(param.getTeacherAuditRecordId());
        return R.ok().put("busTeacherAuditRecord", busTeacherAuditRecord);
    }

}
