package com.yida.data.customForm.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.FebsResponse;
import com.yida.data.common.core.entity.QueryRequest;
import com.yida.data.common.core.entity.customform.CoreCustomFormType;
import com.yida.data.common.core.exception.FebsException;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.customForm.service.CoreCustomFormTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 自定义表单类型表 Controller
 *
 * @author wjm
 * @date 2021-08-12 10:56:57
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/coreCustomFormType")
@RequiredArgsConstructor
@Api(tags = "后台--表单类型")
public class CoreCustomFormTypeController {

    @Autowired
    private final CoreCustomFormTypeService coreCustomFormTypeService;


    @ApiOperation("查询自定义表单类型LIST")
    @GetMapping("/findList")
    public ResultBean<List<CoreCustomFormType>> fondTypeList(){
        List<CoreCustomFormType> type = coreCustomFormTypeService.list();
        return ResultBean.buildSuccess(type);
    }

    @ApiOperation("新增表单类型")
    @PostMapping("/insertFormType")
    public ResultBean insertFormType(@RequestBody CoreCustomFormType coreCustomFormType){
        coreCustomFormTypeService.save(coreCustomFormType);
        return ResultBean.buildSuccess();
    }
}
