package jnpf.attendance.controller;


import io.swagger.v3.oas.annotations.Operation;
import jnpf.attendance.service.AttendanceCustomizeTableService;
import jnpf.base.ActionResult;
import jnpf.model.attendance.vo.attendance.AttendanceCustomizeTableVo;
import jnpf.model.attendance.vo.attendance.CustomizeTableUpdateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * 考勤统计WEB
 *
 * @author ahua
 * @since 2024-09-03
 */
@RestController
@RequestMapping("/attendance/customizeTable")
public class AttendanceCustomizeTableController {
    @Autowired
    private AttendanceCustomizeTableService tableService;

    @GetMapping
    @Operation(summary = "自定义报表设置-列表查询")
    public ActionResult<List<AttendanceCustomizeTableVo>> findList(@RequestParam(required = false) String keyword,
                                                                   @RequestParam(required = false) Integer status,
                                                                   @RequestParam(required = false, defaultValue = "1") Integer type) {
        return ActionResult.success(tableService.findList(keyword, status, type));
    }

    @PutMapping
    @Operation(summary = "自定义报表设置-设置")
    public ActionResult<Void> update(@Valid @RequestBody CustomizeTableUpdateVo tableVos) {
        tableService.update(tableVos);
        return ActionResult.success();
    }

}

