package com.xunmei.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

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.xunmei.common.log.annotation.Log;
import com.xunmei.common.log.enums.BusinessType;
import com.xunmei.common.security.annotation.RequiresPermissions;
import com.xunmei.system.domain.SysWorkTimeMonth;
import com.xunmei.system.service.ISysWorkTimeMonthService;
import com.xunmei.common.core.web.controller.BaseController;
import com.xunmei.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xunmei.common.core.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author xunmei
 * @date 2023-08-14
 */
@Api(tags = {"SysWorkTimeMonth"})
@RestController
@RequestMapping("/api/work/time/month/")
public class SysWorkTimeMonthController extends BaseController {
    @Autowired
    private ISysWorkTimeMonthService sysWorkTimeMonthService;

    /**
     * 查询【请填写功能名称】列表
     */
    @ApiOperation(value = "查询SysWorkTimeMonth列表")
    @RequiresPermissions("system:month:list")
    @GetMapping("/list")
    public TableDataInfo<SysWorkTimeMonth> list(SysWorkTimeMonth sysWorkTimeMonth) {

        return sysWorkTimeMonthService.selectPage(sysWorkTimeMonth);
    }


    /**
     * 获取【请填写功能名称】详细信息
     */
    @ApiOperation(value = "获取SysWorkTimeMonth详细信息")
    @RequiresPermissions("system:month:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(sysWorkTimeMonthService.selectSysWorkTimeMonthById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation(value = "新增SysWorkTimeMonth")
    @RequiresPermissions("system:month:add")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysWorkTimeMonth sysWorkTimeMonth) {
        return toAjax(sysWorkTimeMonthService.insertSysWorkTimeMonth(sysWorkTimeMonth));
    }

    /**
     * 修改【请填写功能名称】
     */
    @ApiOperation(value = "修改SysWorkTimeMonth")
    @RequiresPermissions("system:month:edit")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody SysWorkTimeMonth sysWorkTimeMonth) {
        return toAjax(sysWorkTimeMonthService.updateSysWorkTimeMonth(sysWorkTimeMonth));
    }

    /**
     * 删除【请填写功能名称】
     */
    @ApiOperation(value = "删除SysWorkTimeMonth")
    @RequiresPermissions("system:month:remove")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(sysWorkTimeMonthService.deleteSysWorkTimeMonthByIds(ids));
    }
}
