package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.entity.TenantApplyCallRecord;
import com.ym.mec.biz.service.TenantApplyCallRecordService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import com.ym.mec.common.page.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 机构申请记录(TenantApplyCallRecord)表控制层
 *
 * @author hgw
 * @since 2022-02-09 10:44:00
 */
@Api(tags = "机构申请记录")
@RestController
@RequestMapping("/tenantApplyCallRecord")
public class TenantApplyCallRecordController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private TenantApplyCallRecordService tenantApplyCallRecordService;

    @ApiOperation("分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "applyId", value = "申请表id", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "startTime", value = "开始时间-年月日时分秒", dataType = "String"),
            @ApiImplicitParam(name = "endTime", value = "开始时间-年月日时分秒", dataType = "String"),
    })
    @PostMapping("/queryPage")
    @PreAuthorize("@pcs.hasPermissions('tenantApplyCallRecord/queryPage')")
    public HttpResponseResult<PageInfo<TenantApplyCallRecord>> queryPage(@RequestBody Map<String, Object> param) {
        return succeed(tenantApplyCallRecordService.queryPage(param));
    }

    @ApiOperation("添加")
    @PostMapping("/add")
    @PreAuthorize("@pcs.hasPermissions('tenantApplyCallRecord/add')")
    public HttpResponseResult add(@RequestBody TenantApplyCallRecord obj) {
        tenantApplyCallRecordService.insert(obj);
        return succeed();
    }

}

