package com.ruoyi.model.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.model.domain.AppCheckImageType;
import com.ruoyi.model.service.IAppCheckImageTypeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 打卡图片类型Controller
 * 
 * @author ruoyi
 * @date 2025-03-08
 */
@RestController
@RequestMapping("/model/AppCheckImageType")
public class AppCheckImageTypeController extends BaseController
{
    @Autowired
    private IAppCheckImageTypeService appCheckImageTypeService;

    /**
     * 查询打卡图片类型列表
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:list')")
    @GetMapping("/list")
    public TableDataInfo list(AppCheckImageType appCheckImageType)
    {
        startPage();
        List<AppCheckImageType> list = appCheckImageTypeService.selectAppCheckImageTypeList(appCheckImageType);
        return getDataTable(list);
    }

    /**
     * 导出打卡图片类型列表
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:export')")
    @Log(title = "打卡图片类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AppCheckImageType appCheckImageType) throws IOException {
        List<AppCheckImageType> list = appCheckImageTypeService.selectAppCheckImageTypeList(appCheckImageType);
        ExcelUtil<AppCheckImageType> util = new ExcelUtil<AppCheckImageType>(AppCheckImageType.class);
        util.exportExcel(response, list, "打卡图片类型数据");
    }

    /**
     * 获取打卡图片类型详细信息
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:query')")
    @GetMapping(value = "/{checkImageTypeId}")
    public AjaxResult getInfo(@PathVariable("checkImageTypeId") Long checkImageTypeId)
    {
        return success(appCheckImageTypeService.selectAppCheckImageTypeByCheckImageTypeId(checkImageTypeId));
    }

    /**
     * 新增打卡图片类型
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:add')")
    @Log(title = "打卡图片类型", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppCheckImageType appCheckImageType)
    {
        return toAjax(appCheckImageTypeService.insertAppCheckImageType(appCheckImageType));
    }

    /**
     * 修改打卡图片类型
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:edit')")
    @Log(title = "打卡图片类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppCheckImageType appCheckImageType)
    {
        return toAjax(appCheckImageTypeService.updateAppCheckImageType(appCheckImageType));
    }

    /**
     * 删除打卡图片类型
     */
    @PreAuthorize("@ss.hasPermi('model:AppCheckImageType:remove')")
    @Log(title = "打卡图片类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{checkImageTypeIds}")
    public AjaxResult remove(@PathVariable Long[] checkImageTypeIds)
    {
        return toAjax(appCheckImageTypeService.deleteAppCheckImageTypeByCheckImageTypeIds(checkImageTypeIds));
    }
}
