package com.usky.fire.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.common.log.annotation.Log;
import com.usky.common.log.enums.BusinessType;
import com.usky.fire.domain.DemLargeSecurityManage;
import com.usky.fire.service.DemLargeSecurityManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 大型安保管理 前端控制器
 * </p>
 *
 * @author JCB
 * @since 2022-10-26
 */
@RestController
@RequestMapping("/demLargeSecurityManage")
public class DemLargeSecurityManageController {

    @Autowired
    private DemLargeSecurityManageService demLargeSecurityManageService;

    /**
     * 大型安保管理-列表
     *
     * @param securityTipsName 安保提示名称
     * @param id               主键ID
     * @param pageNum          当前页面
     * @param pageSize         每页条数
     * @return
     */
    @GetMapping("largeSecurityManageList")
    public ApiResult<CommonPage<DemLargeSecurityManage>> largeSecurityManageList(@RequestParam(value = "securityTipsName", required = false) String securityTipsName,
                                                                                 @RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
                                                                                 @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                                                 @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
        return ApiResult.success(demLargeSecurityManageService.largeSecurityManageList(securityTipsName, id, pageNum, pageSize));
    }

    /**
     * 大型安保管理-新增
     *
     * @param demLargeSecurityManage
     */
    @Log(title = "大型安保管理-新增", businessType = BusinessType.INSERT)
    @PostMapping("addLargeSecurityManage")
    public ApiResult<Void> addLargeSecurityManage(@RequestBody DemLargeSecurityManage demLargeSecurityManage) {
        demLargeSecurityManageService.addLargeSecurityManage(demLargeSecurityManage);
        return ApiResult.success();
    }

    /**
     * 大型安保管理-修改
     *
     * @param demLargeSecurityManage
     */
    @Log(title = "大型安保管理-修改", businessType = BusinessType.UPDATE)
    @PutMapping("updateLargeSecurityManage")
    public ApiResult<Void> updateLargeSecurityManage(@RequestBody DemLargeSecurityManage demLargeSecurityManage) {
        demLargeSecurityManageService.updateLargeSecurityManage(demLargeSecurityManage);
        return ApiResult.success();
    }

    /**
     * 大型安保管理-删除
     *
     * @param id 主键ID
     */
    @Log(title = "大型安保管理-删除", businessType = BusinessType.DELETE)
    @DeleteMapping("delLargeSecurityManage")
    public ApiResult<Void> delLargeSecurityManage(@RequestParam(value = "id") Integer id) {
        demLargeSecurityManageService.delLargeSecurityManage(id);
        return ApiResult.success();
    }

}

