package com.ruoyi.zhushi.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.zhushi.entity.AppDTO;
import com.ruoyi.zhushi.entity.DkAttendanceGroupDTO;
import com.ruoyi.zhushi.entity.DkCheckInConfigDTO;
import com.ruoyi.zhushi.service.DkAttendanceGroupService;
import com.ruoyi.zhushi.service.DkConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 打卡配置控制台
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/dk/attendanceGroup")
@Slf4j
public class DkAttendanceGroupController extends BaseController {


    @Autowired
    private DkAttendanceGroupService dkAttendanceGroupService;

    @GetMapping("/list")
    public TableDataInfo<DkAttendanceGroupDTO> list(DkAttendanceGroupDTO dkAttendanceGroupDTO) {
        return dkAttendanceGroupService.queryPageList(dkAttendanceGroupDTO);
    }

    @PostMapping("/add")
    public R<String> add(@RequestBody DkAttendanceGroupDTO dkAttendanceGroupDTO) {
        return R.ok(dkAttendanceGroupService.add(dkAttendanceGroupDTO));
    }

    @DeleteMapping("/del/{id}")
    public R<Void> del(@PathVariable Long id) {
        return toAjax(dkAttendanceGroupService.del(id));
    }

    @DeleteMapping("/delUser/{id}")
    public R<Void> delUser(@PathVariable long id) {
        return toAjax(dkAttendanceGroupService.deleteConfig(id));
    }
}
