package com.ruoyi.postCheck.controller;

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.postCheck.domain.PostCheckedItems;
import com.ruoyi.postCheck.service.IPostCheckedItemsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;

/**
 * 岗检表管理明细Controller
 *
 * @author csg
 * @date 2024-01-05
 */
@Api(tags = "2.5.2-岗检表管理明细接口（废弃不调）")
@RestController
@RequestMapping("/postCheck/postCheckedItems")
public class PostCheckedItemsController extends BaseController
{
    @Autowired
    private IPostCheckedItemsService postCheckedItemsService;

    /**
     * 查询岗检表管理明细列表
     */
    @ApiOperation("查询岗检表管理明细列表")
    @ApiImplicitParams({
                    @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "postCheckedId", value = "岗位责任制检查表ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "type", value = "检查项目：参考post_list_info表；类型（1-业务职责；2-党建及党风廉政建设职责；3-安全环保职责；4-合规保密职；5-任职资格与能力素质要求）", dataType = "Integer", dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "postCheckedContent", value = "检查内容", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedStandard", value = "检查标准", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedMethod", value = "检查方法", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedResult", value = "检查结果", dataType = "String", dataTypeClass = String.class),
                @ApiImplicitParam(name = "pageNum", value = "页码从1开始", dataType = "Integer", dataTypeClass = Integer.class),
                @ApiImplicitParam(name = "pageSize", value = "分页大小", dataType = "Integer", dataTypeClass = Integer.class),
                @ApiImplicitParam(name = "orderBy", value = "排序字段", dataType = "String", dataTypeClass = String.class)
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:list')")
    @GetMapping("/list")
    public TableDataInfo list(PostCheckedItems postCheckedItems)
    {
        startPage();
        List<PostCheckedItems> list = postCheckedItemsService.selectPostCheckedItemsList(postCheckedItems);
        return getDataTable(list);
    }

    /**
     * 导出岗检表管理明细列表
     */
    @ApiOperation("导出岗检表管理明细列表")
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:export')")
    @Log(title = "岗检表管理明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PostCheckedItems postCheckedItems)
    {
        List<PostCheckedItems> list = postCheckedItemsService.selectPostCheckedItemsList(postCheckedItems);
        ExcelUtil<PostCheckedItems> util = new ExcelUtil<PostCheckedItems>(PostCheckedItems.class);
        util.exportExcel(response, list, "岗检表管理明细数据");
    }

    /**
     * 获取岗检表管理明细详细信息
     */
    @ApiOperation("获取岗检表管理明细详细信息")
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(postCheckedItemsService.selectPostCheckedItemsById(id));
    }

    /**
     * 新增岗检表管理明细
     */
    @ApiOperation("新增岗检表管理明细")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Long", dataTypeClass = Long.class),
        @ApiImplicitParam(name = "postCheckedId", value = "岗位责任制检查表ID", dataType = "Long", dataTypeClass = Long.class),
        @ApiImplicitParam(name = "type", value = "检查项目：参考post_list_info表；类型（1-业务职责；2-党建及党风廉政建设职责；3-安全环保职责；4-合规保密职；5-任职资格与能力素质要求）", dataType = "Integer", dataTypeClass = Integer.class),
        @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
        @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
        @ApiImplicitParam(name = "postCheckedContent", value = "检查内容", dataType = "String", dataTypeClass = String.class),
        @ApiImplicitParam(name = "postCheckedStandard", value = "检查标准", dataType = "String", dataTypeClass = String.class),
        @ApiImplicitParam(name = "postCheckedMethod", value = "检查方法", dataType = "String", dataTypeClass = String.class),
        @ApiImplicitParam(name = "postCheckedResult", value = "检查结果", dataType = "String", dataTypeClass = String.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:add')")
    @Log(title = "岗检表管理明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PostCheckedItems postCheckedItems)
    {
        return toAjax(postCheckedItemsService.insertPostCheckedItems(postCheckedItems));
    }

    /**
     * 修改岗检表管理明细
     */
    @ApiOperation("修改岗检表管理明细")
    @ApiImplicitParams({
                    @ApiImplicitParam(name = "id", value = "主键ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "postCheckedId", value = "岗位责任制检查表ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "type", value = "检查项目：参考post_list_info表；类型（1-业务职责；2-党建及党风廉政建设职责；3-安全环保职责；4-合规保密职；5-任职资格与能力素质要求）", dataType = "Integer", dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "delFlag", value = "删除标志（0代表存在 2代表删除）", dataType = "Integer", dataTypeClass = Integer.class),
                    @ApiImplicitParam(name = "createUserId", value = "创建者用户ID", dataType = "Long", dataTypeClass = Long.class),
                    @ApiImplicitParam(name = "postCheckedContent", value = "检查内容", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedStandard", value = "检查标准", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedMethod", value = "检查方法", dataType = "String", dataTypeClass = String.class),
                    @ApiImplicitParam(name = "postCheckedResult", value = "检查结果", dataType = "String", dataTypeClass = String.class),
    })
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:edit')")
    @Log(title = "岗检表管理明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PostCheckedItems postCheckedItems)
    {
        return toAjax(postCheckedItemsService.updatePostCheckedItems(postCheckedItems));
    }

    /**
     * 删除岗检表管理明细
     */
    @ApiOperation("删除岗检表管理明细")
    @ApiImplicitParam(name = "ids", value = "Long类型的主键数组", dataType = "Long[]", dataTypeClass = Long[].class)
    @PreAuthorize("@ss.hasPermi('postCheck:postCheckedItems:remove')")
    @Log(title = "岗检表管理明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(postCheckedItemsService.deletePostCheckedItemsByIds(ids));
    }
}
